package com.tongren.framework.widgets.pull;

import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * 通过成员变量存储对应的convertView中需要操作的字View，避免每次findViewById，从而提升运行的效率
 *
 */
public abstract class BaseViewHolder extends RecyclerView.ViewHolder {
    public BaseViewHolder(View itemView) {
        super(itemView);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onItemClick(v, getAdapterPosition());
            }
        });
    }
    // 绑定数据
    public abstract void onBindViewHolder(int position);
    // recyclerview点击事件
    public abstract void onItemClick(View view, int position);
}
